<template>
  <div class="number dd-row">
    <div class="minus" @click="minus">
      <img v-show="!!num" src="@/assets/img/minus.png" alt="-">
    </div>
    <div class="num">
      <p v-show="!!num">
        {{num}}
      </p>
    </div>
    <div class="add" @click="add">
      <img src="@/assets/img/add.png" alt="+">
    </div>
  </div>
</template>
<script>
import { mapMutations } from "vuex";
export default {
  props: ["id", "num"],
  methods: {
    add() {
      this.$store.commit("addData", this.id);
      this.fixed();
    },
    minus() {
      if (this.num <= 0) return false;
      this.$store.commit("minusData", this.id);
      this.fixed();
    },
    // 结算
    fixed() {
      this.$store.commit("fixedData");
    }
  }
};
</script>
<style scoped>
.number {
  display: flex;
  flex-direction: row;
  justify-content: flex-end;
  width: 100pt;
}
/* 加减 */

.add,
.minus {
  width: 14pt;
  height: 14pt;
  display: flex;
  align-self: center;
  align-items: center;
  justify-content: center;
}

.add {
  margin-left: 10pt;
}
/*数量*/
.num {
  color: #000;
  font-size: 11pt;
  font-weight: bold;
}
.minus {
  margin-right: 10pt;
}

.add img,
.minus img {
  width: 14pt;
  height: 14pt;
}
</style>

